package com.yjt.fresh.activity;

import android.content.Intent;
import android.view.View;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.yjt.fresh.R;
import com.yjt.fresh.base.BaseSimpleActivity;
import com.yjt.fresh.bean.BeanAfterSaleCheck;
import com.yjt.fresh.constant.MyConstants;

import butterknife.BindView;
import butterknife.ButterKnife;

/**
 *
 * Created by mcc on 2018-09-07.
 */

public class AtyAfterSaleDetail extends BaseSimpleActivity {
    @BindView(R.id.back)
    RelativeLayout mBack;
    @BindView(R.id.tvAppAtyAfterSaleDetailStatus)
    TextView mTvStatus;
    @BindView(R.id.tvAppAtyAfterSaleDetailMoney)
    TextView mTvMoney;
    @BindView(R.id.rlAppAtyAfterSaleDetailTalkDetail)
    RelativeLayout mRlTalkDetail;
    @BindView(R.id.tvAppAtyAfterSaleDetailStoreName)
    TextView mTvStoreName;
    @BindView(R.id.tvAppAtyAfterSaleDetailType)
    TextView mTvType;
    @BindView(R.id.tvAppAtyAfterSaleDetailReason)
    TextView mTvReason;
    @BindView(R.id.tvAppAtyAfterSaleDetailNum)
    TextView mTvNum;
    @BindView(R.id.tvAppAtyAfterSaleDetailTime)
    TextView mTvTime;
    private BeanAfterSaleCheck mBeanAfterSaleCheck;

    @Override
    protected int getContentView() {
        return R.layout.app_aty_after_sale_detail;
    }

    @Override
    protected void initViews() {
        ButterKnife.bind(this);
        mBeanAfterSaleCheck = (BeanAfterSaleCheck) getIntent().getSerializableExtra(MyConstants.ORDER_INFO);
        switch (mBeanAfterSaleCheck.getSTATUS()) {
            case "1":
                mTvStatus.setText("审核中");
                break;
            case "2":
                mTvStatus.setText("商家同意退货");
                break;
            case "3":
                mTvStatus.setText("审核不通过");
                break;
            case "4":
                mTvStatus.setText("退款中");
                break;
            case "5":
                mTvStatus.setText("已退款");
                break;
            case "6":
                mTvStatus.setText("已取消");
                break;
            default:
                break;
        }
        mTvMoney.setText("退款金额:  ¥ "+ mBeanAfterSaleCheck.getBACK_MONEY());
        mTvStoreName.setText(mBeanAfterSaleCheck.getSTORE_NAME());
        if ("1".equals(mBeanAfterSaleCheck.getBACK_TYPE())){
            mTvType.setText("退款");
        }else if ("2".equals(mBeanAfterSaleCheck.getBACK_TYPE())){
            mTvType.setText("退货退款");
        }
        mTvReason.setText(mBeanAfterSaleCheck.getPROBLEM_DESCRIBE());
        mTvNum.setText(mBeanAfterSaleCheck.getBACK_ORDER_NO());
        mTvTime.setText(mBeanAfterSaleCheck.getCREATE_TIME());
    }

    @Override
    protected void initEvent() {
        mRlTalkDetail.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(mContext,AtyTalkDetail.class);
                intent.putExtra(MyConstants.ORDER_ID,mBeanAfterSaleCheck.getBACKORDER_ID());
                startActivity(intent);
            }
        });

        mBack.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });
    }

}
